<?
function canConnectFor($c)
{

	if (!isset($_SESSION)) {   session_start(); }

$CHCK=isset($_SESSION['user_id']) && isset($_SESSION['grouptype']) && !empty($_SESSION['user_id']) && !empty($_SESSION['grouptype']);	$ADMIN=$CHCK && ($_SESSION['grouptype'] == "Admin" );
$ALL=$CHCK && ($_SESSION['grouptype'] == "Admin" || $_SESSION['grouptype'] == "Employee");
	if($c=="ALL")
	{
	    if(!$ALL)
		{
		//echo  "<meta http-equiv='refresh' content='0;URL=index.php?error=2' >";	
                header( "location: index.php?error=2" );
		exit();
		}
	}
	else if($c=="ADMIN")
	{
		if(!$ADMIN)
		{
		//echo  "<meta http-equiv='refresh' content='0;URL=index_admin.php?error=2' >";
                header( "location: index.php?error=2" );
		exit();	
		}
	}
	
}

?>